import { checkUserName, checkPassWord } from 'Utils/index.js'
import '@/css/index.css'
import '@/less/index.less'
import imgObj from './assets/logo.png'
import axios from 'axios'
// alert('1111')
console.log(imgObj);
document.querySelector('.logo-img').src = imgObj
document.querySelector('.login-btn').addEventListener('click',()=>{
  const username = document.querySelector('.username').value
  const password = document.querySelector('.password').value
  if(!checkUserName(username)){
    alert('您输入的用户名长度不够')
  }
  if (!checkPassWord(password)) {
    alert('您输入的密码长度不够')
  }
  console.log('用户名和密码长度符合要求')
  axios({
    url: 'http://hmajax.itheima.net/api/register',
    method: 'POST',
    data: {
      username,
      password
    }
  }).then(result => {
    alert(result.data.message)
  }).catch(error => {
    alert(error.response.data.message)
  })
})

const arr = [1, 2, 3]
const result = arr.map(val => val + 1)
console.log(result)
